home *** CD-ROM | disk | FTP | other *** search
- #pragma once
-
- #ifndef utypes
- #define utypes
- typedef unsigned long ulong;
- typedef unsigned short ushort;
- #endif utypes
-
- struct GlobalsRecord {
- WindowPtr theWindow; // our window, of course
- ulong numLines; // number of lines of displayable text
- ulong textLen; // byte length of text data
- Ptr lines; // buffer of text bytes
- ulong *lineStarts; // array of byte ptrs corresponding to starts of each display line
- ulong curLine; // current line we should start display from
- short lineHeight; // line height for current font in pixels/line
- short displayLines; // number of display lines we can fit in the window
- Boolean idleTrigCalcs;
- Boolean idlePurgeCompact;
- };
-
- typedef struct GlobalsRecord GlobalsRecord;
- typedef struct GlobalsRecord *GlobalsPtr;
-
- extern GlobalsPtr globals;
- extern char gStr[];
- extern ushort gStrLen;
- extern Boolean gPrintFlag;
-
- void AddLineToTextDisplay(GlobalsPtr g, char *format, ulong value);
- void AddStringToTextDisplay(GlobalsPtr g, char *format);
-
- #define MIN(a,b) (((a) <= (b)) ? (a) : (b))
- #define MAX(a,b) (((a) >= (b)) ? (a) : (b))
- #define ABS(a) (((a) < 0) ? -(a) : (a))
-
- #ifdef DEBUG
- #define ShowNum(label, num) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen],label,(num))
- #ifdef THINK_C
- #define ShowPStr(label, pstr) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen],label"\"%#s\"", (pstr))
- #else
- #define ShowPStr(label, pstr) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen],label"\"%.*s\"", (pstr)[0], &((pstr)[1]))
- #endif
- #define ShowOSType(label, type) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen],label"\'%.4s\'", &(type))
- #define ShowStr(label) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen],label)
- #define ShowLenStr(label,len) if (gPrintFlag) gStrLen += sprintf(&gStr[gStrLen], "%.*s", (len), label)
- #define ShowCR() if (gPrintFlag) { \
- gStrLen += sprintf(&gStr[gStrLen]," "); \
- AddStringToTextDisplay(g, gStr); \
- gStrLen = 0; \
- }
- #define TabColumn(col) if (gPrintFlag) { \
- while (gStrLen < col) \
- gStrLen += sprintf(&gStr[gStrLen]," "); \
- }
- #else
- #define ShowNum(label, num) ((void)0)
- #define ShowPStr(label, pstr) ((void)0)
- #define ShowStr(label) ((void)0)
- #define ShowLenStr(label, len) ((void)0)
- #define ShowCR() ((void)0)
- #define TabColumn(col) ((void)0)
- #endif
-
- #define ShowNumCR(label, num) {ShowNum(label,num); ShowCR();}
- #define ShowPStrCR(label, pstr) {ShowPStr(label, pstr); ShowCR();}
- #define ShowOSTypeCR(label, type) {ShowOSType(label, type); ShowCR();}
- #define ShowStrCR(label) {ShowStr(label); ShowCR();}
- #define ShowLenStrCR(label,len) {ShowLenStr(label,len); ShowCR();}
-